import request from '@/utils/request'

// 获取统计数据
export function getStatistics() {
  return request({
    url: '/system/statistics/countOrderInfo',
    method: 'post'
  })
}

// 获取在线用户数
export function getOnlineUsers() {
  return request({
    url: '/monitor/online/list', 
    method: 'get'
  })
}

// 获取今日交易记录
export function getTodayTransactions() {
  return request({
    url: '/system/statistics/today-transactions',
    method: 'post'
  })
}

// 获取最近7天购买趋势
export function getPurchaseTrend() {
  return request({
    url: '/system/statistics/purchase-trend',
    method: 'post'
  })
}


// 获取注册总用户数
export function getRegisterTotalUsers() { 
  return request({
    url: '/system/statistics/register-total-users',
    method: 'post'
  })
}

// 获取今日交易额
export function getTodayAmount() {
  return request({
    url: '/system/statistics/today-amount',
    method: 'post'
  })
} 

// 获取今日交易额
export function getTodayAddUserCount() {
  return request({
    url: '/system/statistics/today-addUserCount',
    method: 'post'
  })
} 


// 获取本月充值趋势
export function getMonthlyRecharge() {
  return request({
    url: '/system/statistics/current-month-recharge-trend',
    method: 'post'
  })
}

// 获取本月充值趋势
export function searchTotal(startTime,endTime) {
  return request({
    url: '/system/statistics/totalData',
    method: 'get',
    params: {
      startTime: startTime,
      endTime:endTime
    }
  })
}

// 设置系统维护时间
export function createMaintenance(row) {
  return request({
    url: '/system/maintenance/createMaintenance',
    method: 'post',
    data: row
  })
}

/**
 * 
 * @returns 获取系统维护时间数据
 */
export function selectMaintenanceInfo() {
  return request({
    url: '/system/maintenance/selectMaintenanceInfo',
    method: 'post'
  })
}

/**
 * 
 * @returns  更新系统维护时间数据
 */
export function updateMaintenance(row) {
  return request({
    url: '/system/maintenance/updateMaintenance',
    method: 'put',
    data: row
  })
}

/**
 * 
 * @returns 获取全局参数数据
 */
export function getGlobalSettings() {
  return request({
    url: '/system/statistics/getGlobalSettings',
    method: 'post'
  })
}

/**
 * 
 * @returns  设置全局参数数据更新
 */
export function setGlobalSettings(row) {
  return request({
    url: '/system/statistics/setGlobalSettings',
    method: 'put',
    data:row
  })
}







